<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>解构赋值</title>
</head>
<body>
<script>
    //数组解构赋值
    let arr = ['100', '200']
    let [a, b] = arr

    let [c, d] = ['300', '400']
    console.log(a, b, c, d)

    //对象解构赋值
    let obj = {name:'Jack',age:18}
    //表示定义一个 name 和一个 age 的变量，获取 obj 当中叫做 name 和 age 的成员的值
    let {name,age} = obj
    console.log(name,age)
    //可以起别名
    //相当于定义一个 a 变量，获取 obj 中 age 的值
    let {age:e} = obj
    console.log(e)
</script>
</body>
</html>